/*
 * asock_type.h
 *
 *  Created on: 2021年1月26日
 *      Author: kimfeng
 */

#ifndef ASOCK_TYPE_H_
#define ASOCK_TYPE_H_

#include <inttypes.h>
#ifdef __linux__
#include <sys/types.h>
#else
typedef unsigned int uint;
typedef unsigned short ushort;
#endif
typedef unsigned char uchar;

#include <vector>

typedef uint connection_id_t;

typedef struct sck_pkg_s
{
	ushort magic_id;
	ushort ver;
	ushort req_num;
	ushort seq_num;
	ushort type;
	ushort pending;
	connection_id_t conn_id;
	uint len;
	void *payload;
}sck_pkg_t;

typedef std::vector<uchar> vec_data_t;

#define PKG_HEADER_SIZE	(sizeof(ushort)*6 + sizeof(uint))
#define PKG_MAX_PAYLOAD_SIZE	(1*1024*1024)

#endif /* ASOCK_TYPE_H_ */
